﻿<%@ Page Title="Заказы" Language="VB" MasterPageFile="~/adminnew/Layout.master" AutoEventWireup="false" CodeFile="Orders.aspx.vb" Inherits="AdminNewOrders" %>
<%@ Import Namespace="System.Globalization" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">

    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css" />
    <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

    <a href="/adminnew/report.aspx/?type=orders&cityid=<%=cityid%>&period_from=<%=PeriodFrom %>&period_to=<%=PeriodTo %>" class="btn btn-success pull-right" style="margin-top: 20px;"><span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span>&nbsp;Выгрузить в Excell</a>
    <h2 class="page-header" style="margin: 20px 0 10px 0;"><%=Master.Page.Title%> (всего <%=total %> закрытых)</h2>

    <div>
        <button type="submit" class="btn btn-primary pull-right"><span class="glyphicon glyphicon-ok" aria-hidden="true"></span>&nbsp;Применить</button>

        <input type="text" class="form-control pull-right" placeholder="Период до" name="period_to" value="<%=PeriodTo %>" style="width: 110px; margin-right: 10px;" />
        <input type="text" class="form-control pull-right" placeholder="Период с" name="period_from" value="<%=PeriodFrom%>" style="width: 110px; margin-right: 10px;" />

        <div class="btn-group  pull-right" style="margin: 0 10px;">
            <input type="hidden" name="cityid" value="<%=cityid%>" />
            <button type="button" class="form-control btn btn-default dropdown-toggle" data-toggle="dropdown">
                <span class="sname" style="width: 158px;">
                    <% Dim city = cities.FirstOrDefault(Function(a) a.city_id = cityid)
                        Dim cityname = "Все города"
                        If IsNothing(city) <> True Then
                            cityname = city.city_name
                        End If
                    %><%=cityname %> &nbsp;</span> &nbsp;<span class="caret"></span>
            </button>
            <ul class="dropdown-menu" role="menu" id="cities" style="min-width: 120px;">
                <li title="<%=Guid.Empty%>" <%=IIf(Guid.Empty=cityid,"active","") %>><a href="#" title="Все города">Все города</a></li>
                <%For Each c In cities%>
                <li title="<%=c.city_id%>" <%=IIf(c.city_id=cityid,"active","") %>><a href="#" title="<%=c.city_name%>"><%=c.city_name%></a></li>
                <%Next%>
            </ul>
        </div>
    </div>
    <div style="clear: both; margin-bottom: 10px;"></div>

    <%If torders.Count <> 0 Then%>
    <table class="table table-bordered table-hover table-condensed table-striped" style="border: none; border-top: 1px solid #ddd;">
        <thead>
            <tr>
                <th width="45px;">№</th>
                <th>ФИО</th>
                <th>Телефон</th>
                <th>Телефон клиента / Откуда / Куда / Примечание</th>
                <th width="105px">Дата заказа</th>
                <th>Ожидание</th>
                <%--<th width="160px">Примечание</th>--%>
                <%--<th>Тел. клиента</th>--%>
                <th>Цена</th>
                <th>Статус</th>
            </tr>
        </thead>
        <tbody>
            <% Dim index = 1%>
            <%For Each o In torders%>
            <tr>
                <td><%=index%></td>
                <td><a href="/adminnew/taxistinfo.aspx/?taxistid=<%=o.taxi_id%>&returlurl=<%=HttpUtility.UrlEncode(Request.Url.AbsolutePath + "/?cityid=" +cityid.ToString()+"&period_from="+PeriodFrom+"&period_to="+PeriodTo)%>" title="Подробнее"><%=o.taxist.taxi_lastname + " " + o.taxist.taxt_firstname%></a></td>
                <td>+<%=o.taxist.taxi_phone%></td>
                <td>Телефон клиента: <%=o.orders.order_user_phone %><br />
                    Город: <%=o.taxist.cities.city_name %><br />
                    Пункт А: <%=o.orders.order_from_address%><br />
                    Пункт Б: <%=o.orders.order_to_address%><br />
                    Примечание: <%=IIf(o.orders.order_comment<> "Примечаний нет!",o.orders.order_comment,"") %>
                </td>
                <td><%=CType(o.orders.order_create, DateTime).AddHours(3).ToString("dd MMMM yyyy г. HH:mm", New CultureInfo("Ru-ru"))%></td>
                <td><%=o.orders.order_time%> мин</td>
                <%--<td><%=IIf(o.orders.order_comment="Примечаний нет!","",(o.orders.order_comment))%></td>--%>
                <%--<td><%=IIF(String.IsNullOrEmpty(o.orders.order_user_phone),"",o.orders.order_user_phone)%></td>--%>
                <td><%=IIf(o.torder_price = 0, "", o.torder_price.ToString())%> </td>
                <td><%=o.torder_status%></td>
            </tr>
            <%index += 1
            Next%>
        </tbody>
        <tfoot style="border: none;">
            <tr style="border: none;">
                <td colspan="6" style="border: none;">
                    <%-- @Html.Partial("_Paginator", PaginationHelper)--%>
                </td>
            </tr>
        </tfoot>
    </table>
    <%Else%>
    <p>Пока заказов не имеется...</p>
    <%End If%>

    <script type="text/javascript">
        $(document).ready(function () {
            setActivePage(2);

            var pickerOpts = {
                closeText: "Закрыть",
                currentText: "Сегодня",
                nextText: "След.",
                prevText: "Пред.",
                monthNames: ["Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", "Сентябрь", "Октябрь", "Ноябрь", "Декабрь"],
                monthNamesShort: ["Янв", "Фев", "Мар", "Апр", "Май", "Июн", "Июл", "Авг", "Сен", "Ок", "Ноя", "Дек"],
                dayNames: ["Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота", "Воскресенье"],
                dayNamesShort: ["Пон", "Вто", "Сре", "Чет", "Пят", "Суб", "Вос"],
                dayNamesMin: ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"],
                dateFormat: 'dd.mm.yy',
                firstDay: 1,
                isRTL: false,
                showButtonPanel: true
            };
            $("input[name=period_from]").datepicker(pickerOpts);
            $("input[name=period_to]").datepicker(pickerOpts);

            $('#cities li').click(function () {
                $('input[name=cityid]').val($(this).attr('title'));
                $('.sname').text($(this).find('a').text());
            });
        });
    </script>

</asp:Content>

